home *** CD-ROM | disk | FTP | other *** search
Wrap
class CPhitGameUI extends CMovieClipFresh { var _calculatingSpinner; var _buttonQuit; var _buttonUndo; var _buttonRedo; var _buttonReset; var _buttonArmorGamesLink; var _msgBoxQuit; var _levelString; var _strTime; var _strMoves; function CPhitGameUI() { super(); } function FirstFrameInitialize() { _root._gameUI = this; this._calculatingSpinner._visible = false; this._buttonQuit.Initialize("Quit",this.OnQuit); this._buttonUndo.Initialize("Undo",this.OnUndo); this._buttonUndo.SetEnabled(false); this._buttonRedo.Initialize("Redo",this.OnRedo); this._buttonRedo.SetEnabled(false); this._buttonReset.Initialize("Reset",this.OnReset); this._buttonReset.SetEnabled(false); this._buttonArmorGamesLink.Initialize("Visit ArmorGames.com",this.OnArmorGames); this._msgBoxQuit.Initialize("Quit?","Would you like to quit this game and return to the main menu? You can come back to this level later.\n\nDo you want to quit?",this.OnQuitConfirmed,this.OnQuitDenied); } function OnAppearDone() { this.stop(); } function OnDisappearDone() { _root._presentation.gotoAndStop("menu"); } function onEnterFrame() { super.onEnterFrame(); var _loc8_ = _root._game.GetLevel(); if(_loc8_ == undefined) { this._levelString = ""; } else { this._levelString = String(_loc8_ + 1); } var _loc4_ = _root._game.GetField().GetTimeTaken(); if(_loc4_ == undefined) { this._strTime = ""; } else { var _loc6_ = int(_loc4_ / 3600); var _loc7_ = int(_loc4_ / 60) % 60; var _loc5_ = int(_loc4_) % 60; this._strTime = (_loc6_ >= 10 ? _loc6_ : "0" + _loc6_) + ":" + (_loc7_ >= 10 ? _loc7_ : "0" + _loc7_) + ":" + (_loc5_ >= 10 ? _loc5_ : "0" + _loc5_); } var _loc9_ = _root._game.GetField().GetNumMovesMade(); if(_loc9_ == undefined) { this._strMoves = ""; } else { this._strMoves = String(_loc9_); } this._buttonUndo.SetEnabled(_root._game.IsUndoAvailable()); this._buttonRedo.SetEnabled(_root._game.IsRedoAvailable()); this._buttonReset.SetEnabled(_root._game.IsUndoAvailable()); this._calculatingSpinner._visible = !_root._game._doneShuffling && _root._game.m_nUpdates > 6; } function OnArmorGames() { _root.getURL("http://www.armorgames.com/","_blank"); } function OnUndo() { _root._game.GetField().UndoLastPieceMove(); } function OnRedo() { _root._game.GetField().RedoLastPieceMove(); } function OnReset() { _root._game.GetField().ResetAllMoves(); } function OnQuit() { FreshDebug.Trace("OnQuit"); _root._gameUI._msgBoxQuit.Show(); _root._game.GetField().SetInteractive(false); } function OnQuitConfirmed() { FreshDebug.Trace("OnQuitConfirmed"); _root._gameUI.gotoAndPlay("disappear"); _root._game.GetFieldHost().gotoAndPlay("disappear"); } function OnQuitDenied() { FreshDebug.Trace("OnQuitDenied"); _root._gameUI._msgBoxQuit.Hide(); _root._game.GetField().SetInteractive(true); } }